package com.soushin.mvpdemo.module.rxjava;

import android.content.Intent;

import java.util.List;

import com.soushin.mvpdemo.Utils.DataUtil;
import com.soushin.mvpdemo.base.BasePresenter;
import com.soushin.mvpdemo.model.OperatorModel;
import com.soushin.mvpdemo.module.rxjava.example.ExampleActivity;
import com.soushin.mvpdemo.module.rxjava.operator.OperatorActivity;

/**
 * Created by SouShin on 2018/11/161437.
 */
public class RxjavaPresenter extends BasePresenter<RxjavaView> {
    private List<OperatorModel> dataList;

    public void setDataList(boolean isExample) {
        dataList = null;
        if (isExample) {
            getMvpView().setActionTitle("示例");
            this.dataList = DataUtil.getExampleList();
        } else {
            getMvpView().setActionTitle("操作符");
            this.dataList = DataUtil.getOperatorList();
        }
        getMvpView().setAdapter(dataList);
    }

    public void clickItem(boolean isExample,String title) {
        Intent intent=new Intent();
        intent.putExtra(RxjavaActivity.key_title,title);
        if (isExample){
            getMvpView().goTo(ExampleActivity.class,intent);
        }else {
            getMvpView().goTo(OperatorActivity.class,intent);
        }
    }
}
